import xmltodict
import json

# 获取所有的 xml文件
# 将所有的xml_dict添加到对应的列表中，然后 转为json也行

# game选择 godot或者

with open('role.xml', 'r', encoding='utf-8') as f:
    content = f.read()
  

xml_dict = xmltodict.parse(content)
dict = {}
dict['role.xml'] = xml_dict
# json_str = json.dumps(xml_dict, indent=2)
json_str = json.dumps(dict)
print(json_str)

# print(xml_dict
#       ['root']
#       ['roles']['role'][1]
#       ['skills']['skill'][0]
#       ['@name']
#       )

# print(xml_dict
#       ['root']
#       ['roles']['role'][1]
#       ['internal_skills']['internal_skill'][0]
#       ['@name']
#       )